package ar.unc.famaf.pln.giveselector.pickers;

import java.util.Iterator;
import java.util.Set;

import ar.unc.famaf.pln.giveselector.context.Context;
import ar.unc.famaf.pln.giveselector.context.Utterance;

/**
 * Picks the Utterance with the maximum number of discretized actions
 * It does not make use of the context
 * @author david
 *
 */
public class BasicPicker implements IPicker {

	@Override
	public Utterance pick(Set<Utterance> utterances, Context context) 
	{
		Utterance picked = null;
		Iterator<Utterance> it = utterances.iterator();
		
		while (it.hasNext())
		{
			Utterance utt = it.next();
			int n1 = utt.getResponse().getDiscretizedActions().size();
			int n2 = (picked != null) ? picked.getResponse().getDiscretizedActions().size() : -1;
			picked = (picked == null || n1 > n2) ? utt : picked;
		}
		return picked;
	}

}
